var URL='http://localhost:88/loveit.com/application/templates/admin';
var PATH='';
$(document).ready(function() {
	
	//VALIDATE =======================================================================================================
	if ($.fn.validate) {
		//Validate page group user
		$("#da-ex-validate1").validate(
				{
					ignore : ".ignore",
					rules : {
						group_name : {
							required : true
						},
						type : {
							required : true
						},
						image : {
							required : true,
							accept : [ "jpeg", "jpg",
									"png", "gif" ]
						},
						permission : {
							required : true
						},
						orders : {
							required : true,
							digits:true
						}
					},
					invalidHandler : function(f, d) {
						var g = d.numberOfInvalids();
						if (g) {
							var e = g == 1 ? "You missed 1 field. It has been highlighted"
									: "You missed "
											+ g
											+ " fields. They have been highlighted";
							$("#da-ex-val1-error").html(e).show();
						} else {
							$("#da-ex-val1-error").hide();
						}
					}
				});
		$("#da-ex-validate1-edit").validate(
				{
					ignore : ".ignore",
					rules : {
						group_name : {
							required : true
						},
						type : {
							required : true
						},
						mission : {
							required : true
						},
						orders : {
							required : true,
							digits:true
						}
					},
					invalidHandler : function(f, d) {
						var g = d.numberOfInvalids();
						if (g) {
							var e = g == 1 ? "You missed 1 field. It has been highlighted"
									: "You missed "
											+ g
											+ " fields. They have been highlighted";
							$("#da-ex-val1-error").html(e).show();
						} else {
							$("#da-ex-val1-error").hide();
						}
					}
				});
		//Validate page Permission
		$("#da-ex-validate-permission").validate(
				{
					ignore : ".ignore",
					rules : {
						name : {
							required : true
						},
						module : {
							required : true
						},
						controller : {
							required : true
						},
						action : {
							required : true
						},
						orders : {
							required : true,
							digits:true
						}
					},
					invalidHandler : function(f, d) {
						var g = d.numberOfInvalids();
						if (g) {
							var e = g == 1 ? "You missed 1 field. It has been highlighted"
									: "You missed "
											+ g
											+ " fields. They have been highlighted";
							$("#da-ex-val-permission-error").html(e).show();
						} else {
							$("#da-ex-val-permission-error").hide();
						}
					}
				});
		//Validate edit article
		$("#da-ex-validate1-article").validate(
				{
					ignore : ".ignore",
					rules : {
						title : {
							required : true
						},
						categories_id : {
							required : true
						},
						status : {
							required : true
						}
					},
					invalidHandler : function(f, d) {
						var g = d.numberOfInvalids();
						if (g) {
							var e = g == 1 ? "You missed 1 field. It has been highlighted"
									: "You missed "
											+ g
											+ " fields. They have been highlighted";
							$("#da-ex-val1-error").html(e).show();
						} else {
							$("#da-ex-val1-error").hide();
						}
					}
				});
		//Validate page slider
		$("#da-ex-validate-slider").validate(
				{
					ignore : ".ignore",
					rules : {
						title : {
							required : true
						},
						link : {
							required : true
						},
						image : {
							required : true,
							accept : [ "jpeg", "jpg",
									"png", "gif" ]
						},
						permission : {
							required : true
						},
						orders : {
							required : true,
							digits:true
						}
					},
					invalidHandler : function(f, d) {
						var g = d.numberOfInvalids();
						if (g) {
							var e = g == 1 ? "You missed 1 field. It has been highlighted"
									: "You missed "
											+ g
											+ " fields. They have been highlighted";
							$("#da-ex-val1-error").html(e).show();
						} else {
							$("#da-ex-val1-error").hide();
						}
					}
				});
		$("#da-ex-validate1-slider-edit").validate(
				{
					ignore : ".ignore",
					rules : {
						title : {
							required : true
						},
						type : {
							required : true
						},
						mission : {
							required : true
						},
						orders : {
							required : true,
							digits:true
						}
					},
					invalidHandler : function(f, d) {
						var g = d.numberOfInvalids();
						if (g) {
							var e = g == 1 ? "You missed 1 field. It has been highlighted"
									: "You missed "
											+ g
											+ " fields. They have been highlighted";
							$("#da-ex-val1-error").html(e).show();
						} else {
							$("#da-ex-val1-error").hide();
						}
					}
				});
		
		
	}//END VALIDATE
	
	//DIALOG ========================================================================================================
	//Dialog delete group user
	$("#form_list_group_user .da-ex-dialog-form").bind("click", function(d) {
		$.post($(this).attr('href'),function(data){
			if(data['STATUS']==1){
				$("#da-ex-dialog-form-div").find('form#da-ex-dialog-form-val').find('span#group_name_label').html(data['0'].group_name);
				$("#da-ex-dialog-form-div").find('form#da-ex-dialog-form-val').find('input[name="group_user"]').val(data['0'].id);
			}
		});
		$("#da-ex-dialog-form-div").dialog("option", {
			modal : true
		}).dialog("open");
		d.preventDefault();
	});
	dialogDeleteAdmin("#da-ex-dialog-form-div",'Delete','Submit','Close',"form#da-ex-dialog-form-val");
	//Submit form delete
	$("form#da-ex-dialog-form-val").submit(function(){
		var id = $(this).find('input[name="group_user"]').val();
		$.post($(this).attr('action')+'?id='+id,function(data){
			if(data['STATUS']==1){
				alert('Delete group user successfull');
				$("#da-ex-dialog-form-div").dialog("close");
			}else{
				alert('Delete group user faild');
			}
		});
		return false;
	});
	//Delete multi admin
	deleteMultiAdmin('#delete_multi_group_user','#form_list_group_user','Are you want to delete group user?');
	
	//Dialog page permission
	$("#form_list_group_user .da-ex-dialog-form-permission").bind("click", function(d) {
		$.post($(this).attr('href'),function(data){
			if(data['STATUS']==1){
				$("#da-ex-dialog-form-div-permission").find('form#da-ex-dialog-form-val-permission').find('span#permission_name_label').html(data['0'].name);
				$("#da-ex-dialog-form-div-permission").find('form#da-ex-dialog-form-val-permission').find('input[name="permission_id"]').val(data['0'].id);
			}
		});
		$("#da-ex-dialog-form-div-permission").dialog("option", {
			modal : true
		}).dialog("open");
		d.preventDefault();
	});
	dialogDeleteAdmin("#da-ex-dialog-form-div-permission",'Delete','Submit','Closes',"form#da-ex-dialog-form-val-permission");
	//Submit form delete
	$("form#da-ex-dialog-form-val-permission").submit(function(){
		var id = $(this).find('input[name="permission_id"]').val();
		$.post($(this).attr('action')+'?id='+id,function(data){
			if(data['STATUS']==1){
				alert('Delete permission successfull');
				$("#da-ex-dialog-form-div-permission").dialog("close");
			}else{
				alert('Delete permission faild');
			}
		});
		return false;
	});
	deleteMultiAdmin('#delete_multi_permission','#form_list_permission','Are you want to delete permissions?');
	
	//Dialog page user
	$("#form_list_user .da-ex-dialog-form-user").bind("click", function(d) {
		$.post($(this).attr('href'),function(data){
			if(data['STATUS']==1){
				$("#da-ex-dialog-form-div-user").find('form#da-ex-dialog-form-val-user').find('span#user_label').html(data['0'].username);
				$("#da-ex-dialog-form-div-user").find('form#da-ex-dialog-form-val-user').find('input[name="user_id"]').val(data['0'].id);
			}
		});
		$("#da-ex-dialog-form-div-user").dialog("option", {
			modal : true
		}).dialog("open");
		d.preventDefault();
	});
	dialogDeleteAdmin("#da-ex-dialog-form-div-user",'Delete','Submit','Closes',"form#da-ex-dialog-form-val-user");
	//Submit form delete
	$("form#da-ex-dialog-form-val-user").submit(function(){
		var id = $(this).find('input[name="user_id"]').val();
		$.post($(this).attr('action')+'?id='+id,function(data){
			if(data['STATUS']==1){
				alert('Delete user successfull');
				$("#da-ex-dialog-form-div-user").dialog("close");
			}else{
				alert('Delete user faild');
			}
		});
		return false;
	});
	deleteMultiAdmin('#delete_multi_user','#form_list_user','Are you want to delete user?');
	
	//Dialog page member
	$("#form_list_user .da-ex-dialog-form-member").bind("click", function(d) {
		$.post($(this).attr('href'),function(data){
			if(data['STATUS']==1){
				$("#da-ex-dialog-form-div-member").find('form#da-ex-dialog-form-val-member').find('span#member_label').html(data['0'].username);
				$("#da-ex-dialog-form-div-member").find('form#da-ex-dialog-form-val-member').find('input[name="member_id"]').val(data['0'].id);
			}
		});
		$("#da-ex-dialog-form-div-member").dialog("option", {
			modal : true
		}).dialog("open");
		d.preventDefault();
	});
	dialogDeleteAdmin("#da-ex-dialog-form-div-member",'Delete','Submit','Closes',"form#da-ex-dialog-form-val-member");
	//Submit form delete
	$("form#da-ex-dialog-form-val-member").submit(function(){
		var id = $(this).find('input[name="member_id"]').val();
		$.post($(this).attr('action')+'?id='+id,function(data){
			if(data['STATUS']==1){
				alert('Delete member successfull');
				$("#da-ex-dialog-form-div-member").dialog("close");
			}else{
				alert('Delete member faild');
			}
		});
		return false;
	});
	deleteMultiAdmin('#delete_multi_member','#form_list_user','Are you want to delete member?');
	
	//Dialog page categories
	$("#form_list_user .da-ex-dialog-form-categories").bind("click", function(d) {
		$.post($(this).attr('href'),function(data){
			if(data['STATUS']==1){
				$("#da-ex-dialog-form-div-categories").find('form#da-ex-dialog-form-val-categories').find('span#categories_label').html(data['0'].name);
				$("#da-ex-dialog-form-div-categories").find('form#da-ex-dialog-form-val-categories').find('input[name="categories_id"]').val(data['0'].id);
			}
		});
		$("#da-ex-dialog-form-div-categories").dialog("option", {
			modal : true
		}).dialog("open");
		d.preventDefault();
	});
	dialogDeleteAdmin("#da-ex-dialog-form-div-categories",'Delete','Submit','Closes',"form#da-ex-dialog-form-val-categories");
	//Submit form delete
	$("form#da-ex-dialog-form-val-categories").submit(function(){
		var id = $(this).find('input[name="categories_id"]').val();
		$.post($(this).attr('action')+'?id='+id,function(data){
			if(data['STATUS']==1){
				alert('Delete categories successfull');
				$("#da-ex-dialog-form-div-categories").dialog("close");
			}else{
				alert('Delete categories faild');
			}
		});
		return false;
	});
	deleteMultiAdmin('#delete_multi_categories','#form_list_user','Are you want to delete categories?');
	
	//Dialog page slider
	$("#form_list_user .da-ex-dialog-form-slider").bind("click", function(d) {
		$.post($(this).attr('href'),function(data){
			if(data['STATUS']==1){
				$("#da-ex-dialog-form-div-slider").find('form#da-ex-dialog-form-val-slider').find('span#slider_label').html(data['0'].title);
				$("#da-ex-dialog-form-div-slider").find('form#da-ex-dialog-form-val-slider').find('input[name="slider_id"]').val(data['0'].id);
			}
		});
		$("#da-ex-dialog-form-div-slider").dialog("option", {
			modal : true
		}).dialog("open");
		d.preventDefault();
	});
	dialogDeleteAdmin("#da-ex-dialog-form-div-slider",'Delete','Submit','Closes',"form#da-ex-dialog-form-val-slider");
	//Submit form delete
	$("form#da-ex-dialog-form-val-slider").submit(function(){
		var id = $(this).find('input[name="slider_id"]').val();
		$.post($(this).attr('action')+'?id='+id,function(data){
			if(data['STATUS']==1){
				alert('Delete slider successfull');
				$("#da-ex-dialog-form-div-slider").dialog("close");
			}else{
				alert('Delete slider faild');
			}
		});
		return false;
	});
	deleteMultiAdmin('#delete_multi_slider','#form_list_user','Are you want to delete slider?');
	
	//END DIALOG
	
	//PICKLIST=====================================================================================================================
	
	$("#da-ex-picklist").pickList({
		addText: 'Add item',
		addImage: 'but_add.gif',
		removeText: 'remove item',
		removeImage: 'but_remove.gif',
		ieColor: '#FFFFFF',
		ieBg: 'graytext'
	});
	//END PICKLIST
	
	//Selection jquery
	if($.fn.chosen){
		$("#categories_id").chosen();
		$("#parent_categories").chosen();
		$("#article_id").chosen();
	}
	
	//EDITOR
	if($.fn.elrte){
		editorFull(870,400,'.editor_full');
		
		editorSmall(870,200,'.editor_small');
	}
});



//DEFINE FUNCTION =============================================================================================================
var deleteMultiAdmin = (function(obj,form,message){
	$(obj).click(function(e){
		e.preventDefault();
		var choose = confirm(message);
		if(choose){
			$(form).submit();
		}
	});
});
var dialogDeleteAdmin = (function(obj,title,btnSubmit,btnClose,form){
	if(title==undefined){
		title='Delete';
	}
	if(btnSubmit==undefined){
		btnSubmit='Submit';
	}
	if(btnClose==undefined){
		btnClose='Close Dialog';
	}
	$(obj).dialog({
		autoOpen : false,
		title : title,
		modal : true,
		width : "640",
		buttons : [ {
			text : btnSubmit,
			click : function() {
				$(this).find(form).submit();
			}
			
		},{
			text : btnClose,
			click : function() {
				$(this).dialog("close");
			} 
		}]
	});
});

 //EDITOR FULL
var editorFull = (function(width,height,obj){
		var Options={
				cssClass:"el-rte",
				height:height,
				width:width,
				toolbar:"eldorado",
				cssfiles:[URL+"/plugins/elrte/css/elrte.css"],
				fmAllow:true,
				buttons         : {
					'save'                : 'Save',
					'copy'                : 'Copy',
					'cut'                 : 'Cut',
					'css'                 : 'Css style and class',
					'paste'               : 'Paste',
					'pastetext'           : 'Paste only text',
					'pasteformattext'     : 'Paste formatted text',
					'removeformat'        : 'Clean format', 
					'undo'                : 'Undo last action',
					'redo'                : 'Redo previous action',
					'bold'                : 'Bold',
					'italic'              : 'Italic',
					'underline'           : 'Underline',
					'strikethrough'       : 'Strikethrough',
					'superscript'         : 'Superscript',
					'subscript'           : 'Subscript',
					'justifyleft'         : 'Align left',
					'justifyright'        : 'Ailgn right',
					'justifycenter'       : 'Align center',
					'justifyfull'         : 'Align full',
					'indent'              : 'Indent',
					'outdent'             : 'Outdent',
					'forecolor'           : 'Font color',
					'hilitecolor'         : 'Background color',
					'formatblock'         : 'Format',
					'fontsize'            : 'Font size',
					'fontname'            : 'Font',
					'insertorderedlist'   : 'Ordered list',
					'insertunorderedlist' : 'Unordered list',
					'horizontalrule'      : 'Horizontal rule',
					'blockquote'          : 'Blockquote',
					'div'                 : 'Block element (DIV)',
					'link'                : 'Link',
					'unlink'              : 'Delete link',
					'anchor'              : 'Bookmark',
					'image'               : 'Image',
					'flash'               : 'Flash',
					'table'               : 'Table',
					'tablerm'             : 'Delete table',
					'tableprops'          : 'Table properties',
					'tbcellprops'         : 'Table cell properties',
					'tbrowbefore'         : 'Insert row before',
					'tbrowafter'          : 'Insert row after',
					'tbrowrm'             : 'Delete row',
					'tbcolbefore'         : 'Insert column before',
					'tbcolafter'          : 'Insert column after',
					'tbcolrm'             : 'Delete column',
					'tbcellsmerge'        : 'Merge table cells',
					'tbcellsplit'         : 'Split table cell',
					'docstructure'        : 'Toggle display document structure',
					'elfinder'            : 'Open file manager',
					'fullscreen'          : 'Toggle full screen mode',
					'nbsp'                : 'Non breakable space',
					'stopfloat'           : 'Stop element floating'
				},
				panels      : {
					save       : ['save'],
					copypaste  : ['copy', 'cut', 'paste', 'pastetext', 'pasteformattext', 'removeformat', 'docstructure'],
					undoredo   : ['undo', 'redo'],
					style      : ['bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript'],
					colors     : ['forecolor', 'hilitecolor'],
					elfinder   : ['elfinder'],
					fullscreen : ['fullscreen'],
					alignment  : ['justifyleft', 'justifycenter', 'justifyright', 'justifyfull'],
					indent     : ['outdent', 'indent'],
					format     : ['formatblock', 'fontsize', 'fontname'],
					lists      : ['insertorderedlist', 'insertunorderedlist'],
					elements   : ['horizontalrule', 'blockquote', 'div', 'stopfloat', 'css', 'nbsp'],
					links      : ['link', 'unlink', 'anchor'],
					images     : ['image'],
					media      : ['image', 'flash'],		
					tables     : ['table', 'tableprops', 'tablerm',  'tbrowbefore', 'tbrowafter', 'tbrowrm', 'tbcolbefore', 'tbcolafter', 'tbcolrm', 'tbcellprops', 'tbcellsmerge', 'tbcellsplit']
				},
				toolbars    : {
					tiny     : ['style'],
					compact  : ['save', 'undoredo', 'style', 'alignment', 'lists', 'links', 'fullscreen'],
					normal   : ['save', 'copypaste', 'undoredo', 'style', 'alignment', 'colors', 'indent', 'lists', 'links', 'elements', 'images', 'fullscreen'],
					complete : ['save', 'copypaste', 'undoredo', 'style', 'alignment', 'colors', 'format', 'indent', 'lists', 'links', 'elements', 'media', 'fullscreen'],
					maxi     : ['save', 'copypaste', 'undoredo', 'elfinder', 'style', 'alignment', 'colors', 'format', 'indent', 'lists', 'links', 'elements', 'media', 'tables', 'fullscreen'],
					eldorado : ['save', 'copypaste', 'elfinder', 'undoredo', 'style', 'alignment', 'colors', 'format', 'indent', 'lists', 'links', 'elements', 'media', 'tables', 'fullscreen']
					
				},
				panelNames : {
					save      : 'Save',
					copypaste : 'Copy/Pase',
					undoredo  : 'Undo/Redo',
					style     : 'Text styles',
					colors    : 'Colors',
					alignment : 'Alignment',
					indent    : 'Indent/Outdent',
					format    : 'Text format',
					lists     : 'Lists',
					elements  : 'Misc elements',
					links     : 'Links',
					images    : 'Images',
					media     : 'Media',
					tables    : 'Tables',
					elfinder  : 'File manager (elFinder)'
				},
				fmOpen:function(e){
					$('<div id="myelfinder"></div>').elfinder({
						url 						:URL+"/plugins/elfinder/connectors/php/connector.php",
						lang 						:"en",
						height 						:300,
						rememberLastDir 			:true,//Remeber last opened dir to open it after reload or in next session. This is stored in browser cookie.
						defaultView 				: 'icon',//Default view mode. Can be icons and list.
						sort 						: 'nameDirsFirst',//'nameDirsFirst' - sort by name, directory first|| 'kindDirsFirst' - sort by kind, name, directory first|| 'sizeDirsFirst' - sort by size, name, directory first ||'name' - sort by name ||'kind' - sort by kind, name || 'size' - sort by size, name
						sortDirect 					:'asc',//'asc' - ascent sorting 'desc' - descent sorting
						clientFormatDate 			: false,//Format dates using client. If set to false - backend date format will be used.
						UTCDate 					: false,//Show datetime in UTC timezone. Requires clientFormatDate set to true.
						dateFormat 					: 'M d, Y h:i A',//Mar 13, 2012 05:27 PM
						fancyDateFormat 			: '$1 H:m:i',// will return Today 21:59:34  || File modification datetime format for last two days (today, yesterday). Same syntax as for dateFormat. Use $1 for "Today" and "Yesterday" placeholder.
						resizable 					: true,//Whether or not the elFinder interface will be resizable. This only works if jQuery UI has the resizable plugin loaded.
						notifyDelay 				: 500,//Timeout before open notifications dialogs.
						dragUploadAllow 			: 'auto',//Allow to drag and drop to upload files.
						allowShortcuts 				: true,//Allow shortcuts
						loadTmbs 					: 5,//Amount of thumbnails to create per one request
						showFiles 					: 40,//Lazy load. Amount of files display at once.
						showThreshold 				: 50,//Lazy load. Distance in px to cwd bottom edge to start displaying files.
						requestType 				:'get',//The AJAX request type. Available choices are post and get.
						iframeTimeout 				: 0,//Timeout for upload using iframe.
						sync 						: 0,//Sync content by refreshing cwd every N seconds.
						debug 						: ['error', 'warning', 'event-destroy'],//Debug config
						cookie 						: {
														expires : 30,
														domain  : '',
														path    : '/',
														secure  : false
													},//Cookie option for browsers that does not support localStorage
						commands 					:[
						         						'open', 'reload', 'home', 'up', 'back', 'forward', 'getfile', 'quicklook', 
						         						'download', 'rm', 'duplicate', 'rename', 'mkdir', 'mkfile', 'upload', 'copy', 
						         						'cut', 'paste', 'edit', 'extract', 'archive', 'search', 'info', 'view', 'help',
						         						'resize', 'sort'
						         					],
     					commandsOptions : {
     		                // "getfile" command options.
     		                getfile : {
     		                        onlyURL  : true,
     		                        // allow to return multiple files info
     		                        multiple : false,
     		                        // allow to return filers info
     		                        folders  : false,
     		                        // action after callback (""/"close"/"destroy")
     		                        oncomplete : ''
     		                },
     		                // "upload" command options.
     		                upload : {
     		                        ui : 'uploadbutton'
     		                },
     		                // "quicklook" command options.
     		                quicklook : {
     		                        autoplay : true,
     		                        jplayer  : 'extensions/jplayer'
     		                }
         		        },
         		       ui : ['toolbar', 'places', 'tree', 'path', 'stat'],
					    uiOptions : {
	     						// toolbar configuration
	     						toolbar : [
	     							['back', 'forward'],
	     							['reload'],
	     							['home', 'up'],
	     							['mkdir', 'mkfile', 'upload'],
	     							['open', 'download', 'getfile'],
	     							['info'],
	     							['quicklook'],
	     							['copy', 'cut', 'paste'],
	     							['rm'],
	     							['duplicate', 'rename', 'edit', 'resize'],
	     							['extract', 'archive'],
	     							['search'],
	     							['view'],
	     							['help']
	     						],
	
	     						// directories tree options
	     						tree : {
	     							// expand current root on init
	     							openRootOnLoad : true,
	     							// auto load current dir parents
	     							syncTree : true
	     						},
	
	     						// navbar options
	     						navbar : {
	     							minWidth : 150,
	     							maxWidth : 500
	     						},
	
	     						// current working directory options
	     						cwd : {
	     							// display parent directory in listing as ".."
	     							oldSchool : false
	     						}
	     					},
	     				
					
						toolbar:[["back","reload"],["select","open"],["quicklook","info","rename"],["resize","icons","list","help"]],
						contextmenu:{
							// navbarfolder menu
							navbar : ['open', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'info'],
	
							// current directory menu
							cwd    : ['reload', 'back', '|', 'upload', 'mkdir', 'mkfile', 'paste', '|', 'info'],
	
							// current directory file menu
							files  : ["select","open",'copy', 'cut', 'paste', 'duplicate', '|', 'edit', 'rename', 'resize','quicklook','getfile','rm','info'],
							file:["select","open",'copy', 'cut', 'paste', 'duplicate', '|', 'edit', 'rename', 'resize','quicklook','getfile','rm','info']
							},
						dialog:{
							width:640,
							modal:true,
							title:"Select Image"
							},
						closeOnEditorCallback:true,
						editorCallback:e
					}).elfinder('instance');
				}};
			$(obj).elrte(Options);
});

//EDITOR SMALL
var editorSmall = (function(width,height,obj){
	var Options={
			cssClass:"el-rte",
			height:height,
			width:width,
			allowSource:false,
			toolbar:"tiny",
			cssfiles:[URL+"/plugins/elrte/css/elrte.css"],
			fmAllow:true,
			fmOpen:function(e){
				$('<div id="myelfinder"></div>').elfinder({
					url:URL+"/plugins/elfinder/connectors/php/connector.php",
					lang:"en",
					height:300,
					toolbar:[["back","reload"],["select","open"],["quicklook","info","rename"],["resize","icons","list","help"]],
					contextmenu:{
						cwd:["reload","delim","info"],
						file:["select","open","rename"],
						},
					dialog:{
						width:640,
						modal:true,
						title:"Select Image"
						},
					closeOnEditorCallback:true,
					editorCallback:e
				});
			}};
		$(obj).elrte(Options);
});
//END DEFINE FUNCTION